const { Service } = require("egg");

class RoleService extends Service {
    /**
     * 保存验证码
     * @param {string} mobile 手机号
     * @param {string} code 验证码
     */
    async create(mobile, code) {
        let sql = "insert into code (mobile, code) values (?, ?)";
        let params = [mobile, code];
        let res = await this.app.mysql.query(sql, params);
        return res;
    }

    /**
     * 获取角色列表
     */
    async readList() {
        let sql = "select * from role";
        let res = await this.app.mysql.query(sql);
        return res;
    }
}

module.exports = RoleService;
